<template>
  <i class="svg-icon">
    <svg aria-hidden="true">
      <use :xlink:href="`#${prefix}${props.font}`" />
    </svg>
  </i>
</template>

<script lang="ts" setup>
import { computed } from 'vue'
import { css_prefix_text as prefix } from '@/assets/icon/iconfont.json'

const props = defineProps({
  font: {
    type: String,
    default: ''
  },
  size: {
    type: Number,
    default: 24
  }
})
const sizeToRem = computed(() => `${props.size}px`)
</script>

<style lang="scss" scoped>
.svg-icon {
  font-size: v-bind(sizeToRem);
  vertical-align: middle;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  svg {
    vertical-align: middle;
    display: inline-block;
    fill: currentColor;
    width: 1em;
    height: 1em;
  }
}
</style>
